package com.lry.pda.bottom.c.backend.executor;

import com.lry.pda.bottom.c.backend.code.CodeKey;
import com.lry.pda.bottom.c.backend.code.CodeNode;

public class IfStatementExecutor extends BaseExecutor{
    @Override
    public void execute(CodeNode root) {
        CodeNode child = executeChild(root, 0);
        Integer val = (Integer)child.getAttr(CodeKey.VALUE);
        copyChild(root, child);

        //执行if里面的代码
        if (val != null && val != 0) {
            executeChild(root, 1);
        }
    }
}
